const mysql = require("mysql");
var client = mysql.createConnection({
    host: "localhost",
    user: "root",
    password: "lantianyu3626",
    database: "tea"
})

function sqlFn(sql, arr, callback) {
    client.query(sql, arr, function (error, result) {
        if (error) {
            console.log('数据库语句错误');
            return;
        }
        // 回调函数
        callback(result)
    })
}

module.exports = sqlFn